class OrdenServicio < ActiveRecord::Base
  belongs_to :compania
  belongs_to :empleado
  belongs_to :cliente 
  belongs_to :direccion
  
  has_many :paquetes, :dependent => :destroy
  has_many :etapas, :dependent => :destroy
  accepts_nested_attributes_for :paquetes, :allow_destroy => true
  accepts_nested_attributes_for :direccion, :allow_destroy => true
  
  
  validates_presence_of     :direccion_id
  validates_presence_of     :nombre_receptor
  validates_length_of       :nombre_receptor,    :maximum => 50
  validates_presence_of     :apellido_receptor
  validates_length_of       :apellido_receptor,    :maximum => 50
  validates_presence_of     :direccion_envio
  validates_length_of       :direccion_envio,    :maximum => 50
  
end

      	